<?php
/**
 * @link http://cn2.php.net/manual/en/migration54.incompatible.php
 * @version $Id: 9_empty_obj.php 211 2012-03-02 10:56:14Z horseluke@126.com $
 */

/*
9. Turning NULL, FALSE, or an empty string into an object by adding 
a property will now emit an E_WARNING level error, instead of E_STRICT.

备注：
强制将sting转换为对象后，出现属性scalar的解析：
http://cn2.php.net/manual/en/language.types.object.php

PHP 5.3(5.2):
object(stdClass)#1 (1) {
  ["scalar"]=>
  string(4) "obj1"
}
object(stdClass)#3 (1) {
  ["scalar"]=>
  string(4) "obj2"
}

PHP 5.4:
object(stdClass)#1 (1) {
  ["scalar"]=>
  string(4) "obj1"
}

Warning: Creating default object from empty value in D:\htdoc_custom\php_5_4\9_e
mpty_obj.php on line 44
object(stdClass)#3 (1) {
  ["scalar"]=>
  string(4) "obj2"
}

*/
error_reporting(E_ALL);

$a = '';


$obj1 = (object)$a;
$obj1->scalar = 'obj1';
var_dump($obj1);


$obj2 = (object)$a->sdfdsf =  'obj2';
var_dump($obj2);